import Cookies from "js-cookie";
// 变量
const tokenKey = "userToken";
const userNameKey = "username";
const headImageKey = "headImage" ;
const userIdKey = "userId";
const userRoleKey = "userRole";
const activeRouterPathKey = "activeRouterPath";

// 写入token，没有过期时间
export function setToken(value) {
    Cookies.set(tokenKey, value);
}

// 获取token
export function getToken() {
    return Cookies.get(tokenKey);
}

// 删除token
export function removeToken() {
    Cookies.remove(tokenKey);
}

// 写入userName
export function setUsername(value) {
    Cookies.set(userNameKey, value);
}

// 获取userName
export function getUsername() {
    return Cookies.get(userNameKey);
}

// 删除userName
export function removeUsername() {
    Cookies.remove(userNameKey);
}

// 写入userId
export function setUserid(value) {
    Cookies.set(userIdKey , value)
}

// 获取userId
export function getUserid() {
    return Cookies.get(userIdKey) ;
}

// 删除userId
export function removeUserid() {
    Cookies.remove(userIdKey) ;
}

// 写入头像
export function setHeadImage(value) {
    Cookies.set(headImageKey , value);
}

// 获取头像
export function getHeadImage() {
    Cookies.get(headImageKey)
}
// 删除头像
export function removeHeadImage() {
    Cookies.remove(headImageKey);
}

// 写入userRole
export function setUserRole(value) {
    Cookies.set(userRoleKey , value) ;
}

// 获取userRole
export function getUserRole() {
    Cookies.get(userRoleKey) ;
}

// 删除userRole
export function removeUserRole() {
    Cookies.remove(userRoleKey) ;
}

// 写入activeRouterPath
export function setActiveRouterPath(value) {
    Cookies.set(activeRouterPathKey, value);
}

// 获取activeRouterPath
export function getActiveRouterPath() {
    return Cookies.get(activeRouterPathKey);
}

// 删除activeRouterPath
export function removeActiveRouterPath() {
    Cookies.remove(activeRouterPathKey);
}